package com.hzcx.app.simplechat.ui.setting.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.base.BaseEmptyBean;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.LoginModel;
import com.hzcx.app.simplechat.model.PublicModel;
import com.hzcx.app.simplechat.model.SettingModel;
import com.hzcx.app.simplechat.ui.login.bean.PhoneCityBean;
import com.hzcx.app.simplechat.ui.login.contract.PhoneCityContract;
import com.hzcx.app.simplechat.ui.setting.contract.UpdatePhoneContract;

import java.util.List;

public class UpdatePhonePresenter extends BasePresenter<UpdatePhoneContract.View> implements UpdatePhoneContract.Presenter {

    /**
     *  修改手机号
     * @param context
     * @param mobile
     * @param captcha
     * @param area_code
     */
    @Override
    public void updatePhone(Context context, String mobile, String captcha, String area_code) {
        SettingModel.updatePhone(context, mobile, captcha, area_code, new BaseDialogObserver<BaseEmptyBean>(context) {
            @Override
            protected void onSuccess(BaseEmptyBean data) {
                mView.updateSuccess();
            }
        });
    }

    /**
     *  发送验证码
     * @param context
     * @param mobile
     * @param event
     * @param area_code
     */
    @Override
    public void sendCode(Context context, String mobile, String event, String area_code) {
        PublicModel.sendCode(context, mobile, event, area_code, new BaseDialogObserver<BaseEmptyBean>(context) {
            @Override
            protected void onSuccess(BaseEmptyBean data) {
                mView.sendCodeSuccess();
            }
        });
    }
}
